//
// Created by Jisam on 2024/7/19.
//
#include <bits/stdc++.h>
#define PSI pair<string,int>
#define PII pair<int,int>
#define VVI vector<vector<int>>
#define VI vector<int>
#define VS vector<string>

#define PQLI priority_queue<int, vector<int>, less<int>>
#define PQGI priority_queue<int, vector<int>, greater<int>>
#define i64 long long

using namespace std;

const int N = 1e5 + 5;
int ans;
struct node{
    int val,idx;
};
void solve() {
    int m,n;
    cin >> n  >> m;
    vector<node> am(m);
    map<int,int> mp;
    for(int i = 0 ; i < m ; i ++ ) {
        cin >> am[i].val;
        am[i].idx = i +1;
    }

    int x;
    for(int i = 0 ; i < n ; i ++ ) {
        cin >> x;
        mp[x] ++;
    }
    for(auto mm : mp)
    {
//        cout << mm.first <<" " << mm.second << "\n";
        am[mm.first - 1].val *= mm.second;
    }
    stable_sort(am.begin(),am.end(),[&](node n1, node n2){return n1.val > n2.val;});
    cout << am[0].idx;
//    for(int i = 0 ; i < m ; i ++ ) {
//        cout << am[i].val << " " << am[i].idx  ;
//    }

}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
        solve();
    return 0;
}